package com.guigu.tms.base.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.tms.base.service.IGoodsTypeService;
import com.guigu.tms.commons.base.entity.GoodsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 货物类型表 前端控制器
 * </p>
 *
 * @author zhh
 * @since 2022-09-23
 */
@RestController
@RequestMapping("/goodsType")
public class GoodsTypeController {

    @Autowired
    IGoodsTypeService service;
    @GetMapping("/GoodsTypeQuery")
    //货品类型管理条件查询分页
   public PageInfo<GoodsType> GoodsTypeQuery(String name, String TruckTypeId, Integer num, Integer size){
        return service.GoodsTypeQuery(name, TruckTypeId, num, size);
    }
    @RequestMapping("/deleteGoodsType")
    //删除货物类型及其关联表数据
    public int deleteGoodsType(int id){

        return  service.deleteGoodsType(id);
    }

    //修改
    @RequestMapping("/updateById")
    public boolean updateById(@RequestBody GoodsType goodsType){

        return service.updateById(goodsType);
    }

    //添加
    @PostMapping("/save")
    public boolean save(@RequestBody GoodsType entity) {
        return service.save(entity);
    }
}
